package com.jbm.Community.Frame;

import com.jbm.Community.R;
import com.jbm.Community.R.layout;

import android.app.Activity;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.MenuItem.OnActionExpandListener;
import android.widget.SearchView;
import android.widget.SearchView.OnQueryTextListener;

public class PiazzaSearchServiceActivity extends ActionBarActivity {
	SearchView searchView=null;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_piazza_search_service);
		android.app.ActionBar actionBar = getActionBar();
		actionBar.setDisplayHomeAsUpEnabled(true); 
	}

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
	    MenuInflater inflater = getMenuInflater();
	    inflater.inflate(R.menu.search_menu, menu);
	    MenuItem searchItem = menu.findItem(R.id.action_search);  
	    this.searchView = (SearchView) searchItem.getActionView();
	    searchItem.setOnActionExpandListener(new OnActionExpandListener() {  
	        @Override  
	        public boolean onMenuItemActionExpand(MenuItem item) {  
	            return true;  
	        }  
	          
	        @Override  
	        public boolean onMenuItemActionCollapse(MenuItem item) {  
	            return true;  
	        }  
	    });
	    
		this.searchView.setOnQueryTextListener(new OnQueryTextListener(){

			@Override
			public boolean onQueryTextChange(String arg0) {
				return false;
			}

			@Override
			public boolean onQueryTextSubmit(String arg0) {
				return false;
			}
		
		});
	    return super.onCreateOptionsMenu(menu); 	    
    } 

    @Override  
    public boolean onOptionsItemSelected(MenuItem item) {  
        switch (item.getItemId()) {  
        case android.R.id.home:  
            finish();  
            return true;  
        }
		return false;  
    }	
}
